package org.grottarossa.ui.core.controls.document.upload;

import org.grottarossa.template.data.pojo.content.Content;
import org.grottarossa.ui.core.ApplicationSession;


/***
 * Factory per i controlli di caricamento file
 * @author Administrator
 *
 */
public class UploadDocumentFactory
{
	/*** Se =true i componenti generati devono eseguire anche il check-in ***/
	private boolean m_checkin;
	private final ApplicationSession m_appSession;

	public UploadDocumentFactory(ApplicationSession appSession, boolean checkin)
	{
		this.m_appSession = appSession;
		m_checkin = checkin;
	}

	/***
	 * Crea un controllo per il caricamento di un file
	 * @param content
	 * @return
	 */
	public UploadDocument create(Content content)
	{
		DocumentUploader uploader = new DocumentUploader(m_appSession, m_checkin, content);
		UploadDocument view = new UploadDocument(m_appSession, null, uploader);
		UploadDocumentPresenter presenter = new UploadDocumentPresenter(m_appSession, view, content);
		presenter.initialize();
		return view;
	}
}
